<template>
  <div class="login">
    <login-top :info="topinfo"></login-top>
    <login-text
      label="姓名"
      placeholder="请输入您的姓名"
      rules=""
      style="margin:20px 0"
      @setContent="(val)=>name=val"
    ></login-text>
    <login-text label="用户名" placeholder="请输入您的账号" rules=""  @setContent="(val)=>username=val"></login-text>
    <login-text
      label="密码"
      placeholder="请输入您的密码"
      rules=""
      type="password"
       @setContent="(val)=>password=val"
    ></login-text>
    <login-btn :current="openClose" btntext="注册" @onemit="setuser"></login-btn>
  </div>
</template>

<script>
import LoginTop from "@/common/Login/LoginTop";
import LoginText from "@/common/Login/LoginText";
import LoginBtn from "@/common/Login/LoginBtn";
import {register} from '../../api/register'
export default {
  data() {
    return {
      topinfo: {
        title: "注册bilibili",
        btn: "用户登录",
      },
      name: "",
      username: "",
      password: "",
    };
  },
  methods: {
    async setuser(){
    let {name,username,password} = this
    let data = await register({name:this.name,username:this.username,password:this.password})
   
  }
  },
  
  components: {
    LoginTop,
    LoginText,
    LoginBtn,
  },
  computed:{
      openClose(){
          return this.name !== ''&& this.username !=='' && this.password !==''
      }
  }
};
</script>

<style lang="less"></style>
